package models
{
	import flash.events.Event;
	
	import mx.resources.ResourceManager;
	
	public class Locale
	{
		[Bindable] public static var WORKING_ON:String;
		[Bindable] public static var PAUSE:String;
		[Bindable] public static var COMPLETE:String;
		[Bindable] public static var SWITCH_TASK:String;
		
		[Bindable] public static var PROJECT:String;
		[Bindable] public static var WORKSPACE:String;
		[Bindable] public static var DISCUSSION:String;
		[Bindable] public static var SETTINGS:String;
		
		[Bindable] public static var UNIT_TASKS:String;
		[Bindable] public static var MESSAGES_BOX:String;
		[Bindable] public static var RESOURCES:String;
		[Bindable] public static var CONTACTS:String;
		[Bindable] public static var USER_ACCOUNT:String;
		[Bindable] public static var APP_SETTING:String;
		
		[Bindable] public static var ALL_FIELDS_REQUIRED:String;
		[Bindable] public static var EMAIL:String;
		[Bindable] public static var ENTER_MAIN_EMAIL:String;
		[Bindable] public static var PASSWORD:String;
		[Bindable] public static var PASS_AGAIN:String;
		[Bindable] public static var USERNAME:String;
		[Bindable] public static var LOGIN:String;
		[Bindable] public static var REGISTER_ACCOUNT:String;
		[Bindable] public static var SEND_ME_PASSWORD:String;
		[Bindable] public static var PASS_NOT_MATCH:String;
		[Bindable] public static var USERNAME_NOT_EXIST:String;
		
		[Bindable] public static var YOUR_LOCAL_TIME:String;
		[Bindable] public static var YOUR_LANGUAGE:String;
		[Bindable] public static var YOUR_DATE_FORMAT:String;

		public static function switchLocale(locales:Array):void{
			var ls:Array = [];
			for each(var obj:Object in locales){
				ls.push(obj.value);
			}
			ResourceManager.getInstance().localeChain = ls;
		}
		public static function registerEventListener():void{
			ResourceManager.getInstance().addEventListener("change", executeGetResource);
		}
		public static function executeGetResource(evet:Event):void{
			WORKING_ON = gs('WORKING_ON'); 
			PAUSE = gs('PAUSE'); 
			COMPLETE = gs('COMPLETE'); 
			SWITCH_TASK = gs('SWITCH_TASK');
			PROJECT = gs('PROJECT'); 
			WORKSPACE = gs('WORKSPACE'); 
			DISCUSSION = gs('DISCUSSION'); 
			SETTINGS = gs('SETTINGS');
			UNIT_TASKS = gs('UNIT_TASKS'); 
			MESSAGES_BOX = gs('MESSAGES_BOX'); 
			RESOURCES = gs('RESOURCES'); 
			CONTACTS = gs('CONTACTS');
			ALL_FIELDS_REQUIRED = gs('ALL_FIELDS_REQUIRED');
			USER_ACCOUNT = gs('USER_ACCOUNT'); 
			APP_SETTING = gs('APP_SETTING');
			EMAIL = gs('EMAIL');
			PASSWORD = gs('PASSWORD');
			PASS_AGAIN = gs('PASS_AGAIN');
			USERNAME = gs('USERNAME');
			LOGIN = gs('LOGIN');
			REGISTER_ACCOUNT = gs('REGISTER_ACCOUNT');
			ENTER_MAIN_EMAIL = gs('ENTER_MAIN_EMAIL');
			SEND_ME_PASSWORD = gs('SEND_ME_PASSWORD');
			PASS_NOT_MATCH = gs('PASS_NOT_MATCH');
			USERNAME_NOT_EXIST = gs('USERNAME_NOT_EXIST');
			YOUR_LOCAL_TIME = gs('YOUR_LOCAL_TIME');
			YOUR_LANGUAGE = gs('YOUR_LANGUAGE');
			YOUR_DATE_FORMAT = gs('YOUR_DATE_FORMAT');
		}
		private static function gs(name:String):String{
			return ResourceManager.getInstance().getString("Interface", name);
		}

	}
}